package pyrachnid.model.robot_model;

import pyrachnid.model.pathFinderModel.Astar;
import pyrachnid.model.pathFinderModel.PathFind;

public class RobotType implements Cloneable {
	private String _nameType;
	private int _maxGroundValue;
	private double _groundInfluence;
	private double _extinguishingSpeed;
	private PathFind _pathFind;
	private String _imagePath;
	private int _decressByTop;
	
	private static String DEFAULT_NAME = "Nouveau type robot";
	private static int DEFAULT_MAX_GROUND_VALUE = 155;
	private static double DEFAULT_GROUND_INFLUENCE = 20;
	private static double DEFAULT_EXTINGUISH_SPEED = 500;
	private static PathFind DEFAULT_PATHFIND = new Astar();
	private static String DEFAULT_IMAGE_PATH = "/images/maps/robot.gif";
	
	public RobotType() {
		_nameType = DEFAULT_NAME;
		_maxGroundValue = DEFAULT_MAX_GROUND_VALUE;
		_extinguishingSpeed = DEFAULT_EXTINGUISH_SPEED;
		_pathFind = DEFAULT_PATHFIND;
		_groundInfluence = DEFAULT_GROUND_INFLUENCE;
		setImagePath(DEFAULT_IMAGE_PATH);
	}
	
	public RobotType(String p_name, int p_maxGround, double p_groundInf, double p_extinguishing, PathFind p_path, String p_imagePath){
		_nameType = p_name;
		_maxGroundValue = p_maxGround;
		_extinguishingSpeed = p_extinguishing;
		_pathFind = p_path;
		_groundInfluence = p_groundInf;
		setImagePath(p_imagePath);
	}
	
	@Override
	public RobotType clone() throws CloneNotSupportedException {
		RobotType clonedRobotType = (RobotType)super.clone();
		clonedRobotType._pathFind = _pathFind.clone();
		return clonedRobotType;
	}

	public String getNameType() {
		return _nameType;
	}

	public void setNameType(String name) {
		_nameType = name;
	}
	
	public int getMaxGroundValue() {
		return _maxGroundValue;
	}

	public void setMaxGroundValue(int ground) {
		_maxGroundValue = ground;
	}
	
	public double getExtinguishingSpeed() {
		return _extinguishingSpeed;
	}

	public void setExtinguishingSpeed(double p_ext) {
		_extinguishingSpeed = p_ext;
	}
	
	public PathFind getPathFind() {
		return _pathFind;
	}

	public void setPathFind(PathFind p_path) {
		_pathFind = p_path;
	}

	public void setGroundInfluence(double groundInfluence) {
		_groundInfluence = groundInfluence;
	}

	public double getGroundInfluence() {
		return _groundInfluence;
	}
	
	public void setImagePath(String imagePath) {
		this._imagePath = imagePath;
	}

	public String getImagePath() {
		return _imagePath;
	}
	
	public int getDecressByTop() {
		return _decressByTop;
	}
	
	@Override
	public String toString(){
		return _nameType;
	}

	public void setDecressByTop(int timeFactor) {
		_decressByTop = Math.round((float) _extinguishingSpeed / timeFactor );
	}
	
}
